fix(mcp): correct the exportTypes MCP-gating example#601
Conversation
The `### exportTypes gating` example showed
`server.http(Resource, { exportTypes: { mcp: false } })`, but server.http
(= httpServer in harper server/http.ts) registers HTTP handlers and never reads
exportTypes — so that call does not gate MCP. The mechanism is the resource
registration call, `server.resources.set(path, Resource, { mcp: false })`
(resources/Resources.ts). Verified against harper main.
Also notes that a `static exportTypes` field on the class is not read, which is
a common adjacent mistake.
Comment generated by kAIle (Claude Opus 4.8)
There was a problem hiding this comment.
Code Review
This pull request updates the documentation in reference/mcp/tools-and-resources.md to clarify that exportTypes gating is configured via server.resources.set rather than server.http, and updates the corresponding code example. There are no review comments, and I have no additional feedback to provide.
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-601 This preview will update automatically when you push new commits. |
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
LGTM — verified against harper main: the corrected server.resources.set(path, Resource, { mcp: false }) matches the set() signature and MCP enumeration gates on exportTypes.mcp !== false, so the old http.ts-based example was genuinely broken. Good fix.
sent with Claude Opus 4.8
Summary
The
### exportTypes gatingsection on the MCP Tools and Resources page documents gating a Resource out of the MCP surface with:That call does not gate anything.
server.http(=httpServer, harperserver/http.ts) registers HTTP handlers and readsport/name/before/after/urlPath/host/runFirst— it has zeroexportTypeshandling. TheexportTypesmap is consumed by the resource registration call:Verified against harper
main:Resources.set(path, resource, exportTypes)(resources/Resources.ts) stores it, and the MCP enumerator readsentry.exportTypes?.mcp(components/mcp/resources.ts). Also added a note that astatic exportTypesfield on the class is not read — a common adjacent mistake.Why now
@kriszyp flagged this same pattern in the
harper-mcpskill review (HarperFast/skills#69), where it was corrected. Theharper-mcpskill is being flipped to generate its rules from these docs, andautomatic-verb-toolsis the one docs-mapped rule that can't flip until this example is fixed — generating from the buggy source would bake the broken call back into the skill. This unblocks that flip.Where to look
One example swapped in
reference/mcp/tools-and-resources.mdplus a one-sentence clarification. Prose about theexportTypes.mcpconcept is unchanged and was already correct.Cross-links: HarperFast/skills#69.
🤖 Generated with Claude Code (Claude Opus 4.8)